﻿using AnesSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.Operation.SC.SCDC
{
    /// <summary>
    /// AnesYiledCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class AnesYiledCtrl : UserControl
    {
        public AnesYiledCtrl()
        {
            InitializeComponent();
            SetDefalutValue();

        }
        private void SetDefalutValue()
        {
           

            LiquidInAndOutModel lquidInAOut = DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.LiquidInAndOut;
            PropertyInfo[] propertys = GetPropertyInfoArray();
            foreach (var propert in propertys)
            {
                if (string.IsNullOrEmpty(propert.GetValue(lquidInAOut).ToString()) )
                {
                    propert.SetValue(lquidInAOut, "/");
                }
               
            }

    }
        private PropertyInfo[] GetPropertyInfoArray()
        {
            PropertyInfo[] props = null;
            try
            {
                Type type = typeof(Models.LiquidInAndOutModel);
                object obj2 = Activator.CreateInstance(type);
                props = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
            }
            catch (Exception ex)
            {
                Common.LogHelper.Error(this.GetType(),ex);
            }
            return props;

        }


    }
}
